﻿namespace Webinator
{
    using System.Globalization;

    using Enums;
    using Impls;

    /// <summary>
    /// Defines how to select an element from a collection.
    /// </summary>
    public static class SelectBy
    {
        public static Selector Text(string value)
        {
            return new Selector { SelectorIs = SelectorIs.Text, Argument = value };
        }

        public static Selector PartialText(string value)
        {
            return new Selector { SelectorIs = SelectorIs.PartialText, Argument = value };
        }

        public static Selector Value(string value)
        {
            return new Selector { SelectorIs = SelectorIs.Value, Argument = value };
        }

        public static Selector PartialValue(string value)
        {
            return new Selector { SelectorIs = SelectorIs.PartialValue, Argument = value };
        }

        public static Selector Index(int value)
        {
            return new Selector { SelectorIs = SelectorIs.Index, Argument = value.ToString(CultureInfo.InvariantCulture) };
        }
    }
}
